﻿using System;
using System.Windows;

using rip.View;
using rip.ViewModel;

namespace rip {
    public partial class App : Application {
        public App() {
            this.Exit += new ExitEventHandler(App_Exit);


        }

        protected override void OnStartup(StartupEventArgs e) {
            base.OnStartup(e);

            MainViewModel mainViewModel = new MainViewModel();

            Main window = new Main();

            EventHandler handler = null;
            handler = delegate {
                mainViewModel.RequestClose -= handler;
                window.Close();
            };
            mainViewModel.RequestClose += handler;

            window.DataContext = mainViewModel;

            window.Show();
        }

        void App_Exit(object sender, ExitEventArgs e) {
            //throw new System.NotImplementedException();
        }
    }
}
